using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace msgExchange
{
    public partial class frmImages : Form
    {
        public delegate void DEL_AddFaceHnadler(int faceID);
        public event DEL_AddFaceHnadler addFace_=null;
        public frmImages()
        {
            InitializeComponent();
        }
        private void clickPicture(object sender, EventArgs e)
        {
            PictureBox pb = (PictureBox)sender;
            int fid = (int)pb.Tag;
            if (this.addFace_ != null)
                this.addFace_(fid);

            Close();
        }
        private void frmImages_Load(object sender, EventArgs e)
        {
            int count = 50;
            int column = 10;
            for (int i = 0; i < count; i++)
            {

                PictureBox box = new PictureBox();
                ((System.ComponentModel.ISupportInitialize)(box)).BeginInit();
                this.SuspendLayout();

                box.Name = "pictureBox"+i.ToString();
                box.Size = new System.Drawing.Size(19, 19);
                box.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
                box.BorderStyle = BorderStyle.FixedSingle;
                box.Tag = (object)(10+i);

                string imgut =Convert.ToString (10 + i);
                box.Image = (Image)Properties.Resources.ResourceManager.GetObject("F_" + imgut);
                box.Location = new Point(i % column * 20, i / column * 20);
                this.Controls.Add(box);
                ((System.ComponentModel.ISupportInitialize)(box)).EndInit();

                box.Click += new EventHandler(clickPicture);

            }
            this.Width = 20 * column + 6;
            this.Height = (count / column + (count % column == 0 ? 0 : 1)) * 20 + 3 + 29;



        }


    }
}